package com.qf.osmarea.service.impl;

import cn.hutool.db.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.common.core.entity.favorite.Favorite;
import com.qf.common.core.util.UserUtils;
import com.qf.osmarea.mapper.FavoriteMapper;
import com.qf.osmarea.param.FavParam;
import com.qf.osmarea.service.FavoriteService;
import com.qf.osmarea.vo.FavoriteVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Qu Xiaotong
 * @data 2025/6/12
 * @desc
 */
@Service
public class FavoriteServiceImpl implements FavoriteService {

    @Resource
    private FavoriteMapper favoriteMapper;

    @Override
    public List<FavoriteVO> getFavorites(FavParam favParam) {

        PageHelper.startPage(favParam.getPage(), favParam.getPageSize());

        List<FavoriteVO> list=favoriteMapper.selectFavoritesById(UserUtils.getUid());

        PageInfo page = new PageInfo(list);

        return page.getList();
    }



}
